Use case: DMA channel direct mode transfer in interrupt mode

Sequence diagram

DMA channel direct mode transfer in interrupt mode.

  @startuml
  hide footbox
  participant "User Application" as part1
  participant "DMA Driver"       as part3
  participant "NVIC"             as part4

  group Configuration
  part1->part3 : HAL_DMA_Init()
  end

  group Process
      group  Start
          part1->part3 : HAL_DMA_Start_IT()
      end

      group  Interrupt
          part4->part3 : HAL_DMA_IRQHandler()
          part3->part1 : User callback()
      end
  end

  @enduml

Code snippet

HAL1

HAL2

HAL_DMA_Init(&hdma);


HAL_DMA_Start_IT(&hdma, (uint32_t)srcBuffer, (uint32_t)destBuffer, dataSize);
HAL_DMA_Init(&hdma1, GPDMA1_CH0);
HAL_DMA_SetConfigDirectXfer(&hdma, &directXferConfig);

HAL_DMA_StartDirectXfer_IT(&hdma, (uint32_t)srcBuffer, (uint32_t)destBuffer, dataSize * multiplier);

Key changes

  1. HAL2 starts interrupt-driven direct transfers using HAL_DMA_StartDirectXfer_IT() (or the optimized variant).

  2. HAL2 uses HAL_DMA_SetConfigDirectXfer() to configure the transfer before starting it.

  3. The DMA interrupt handler remains HAL_DMA_IRQHandler().